package host.springboot.framework.core.execute;

import host.springboot.framework.core.execute.logging.LoggingComponentExecutor;
import host.springboot.framework.core.execute.logging.LoggingRpcExecutor;
import host.springboot.framework.core.logging.LogComponentProvider;
import host.springboot.framework.core.logging.LoggingComponent;
import host.springboot.framework.core.logging.LoggingImpl;
import host.springboot.framework.core.logging.LoggingProvider;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;

/**
 * 日志执行器
 *
 * @author JiYinchuan
 * @since 1.0.0
 */
public class LoggingExecutor {

    // -------------------------------- 基础实例 --------------------------------

    /**
     * 普通日志实例
     *
     * @return 普通日志实例
     * @since 1.0.0
     */
    public static LoggingProvider instance() {
        return new LoggingImpl();
    }

    /**
     * 组件日志实例
     *
     * @param loggingComponent 日志组件
     * @return 组件日志实例
     * @since 1.0.0
     */
    public static LogComponentProvider instance(@NonNull LoggingComponent loggingComponent) {
        return new LoggingComponentExecutor(loggingComponent);
    }

    // -------------------------------- RPC --------------------------------

    /**
     * RPC日志执行器
     *
     * @param param    RPC参数
     * @param response RPC响应
     * @return RPC日志执行器
     * @since 1.0.0
     */
    public static LoggingRpcExecutor rpc(@Nullable Object param, @Nullable Object response) {
        return new LoggingRpcExecutor(param, response);
    }
}
